package acidcart.client;

import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;

public class StateListBox extends ListBox {
    
	public StateListBox()
	{
		String[] listTypes = getStates();
	    this.addItem("Select State");
	    for (int i = 0; i < listTypes.length; i++)
	    	this.addItem(listTypes[i]);
	    
	    this.setWidth("150px");
	}
	
	public static String[] getStates() {
		String[] states = new String[51];
		states[0] = "AL - Alabama";
		states[1] = "AK - Alaska";
		states[2] = "AZ - Arizona";
		states[3] = "AR - Arkansas";
		states[4] = "CA - California";
		states[5] = "CO - Colorado";
		states[6] = "CT - Connecticut";
		states[7] = "DE - Delaware";
		states[8] = "DC - District of Columbia";
		states[9] = "FL - Florida";
		states[10] = "GA - Georgia";
		states[11] = "HI - Hawaii";
		states[12] = "ID - Idaho";
		states[13] = "IL - Illinois";
		states[14] = "IN - Indiana";
		states[15] = "IA - Iowa";
		states[16] = "KS - Kansas";
		states[17] = "KY - Kentucky";
		states[18] = "LA - Louisiana";
		states[19] = "ME - Maine";
		states[20] = "MD - Maryland";
		states[21] = "MA - Massachusetts";
		states[22] = "MI - Michigan";
		states[23] = "MN - Minnesota";
		states[24] = "MS - Mississippi";
		states[25] = "MO - Missouri";
		states[26] = "MT - Montana";
		states[27] = "NE - Nebraska";
		states[28] = "NV - Nevada";
		states[29] = "NH - New Hampshire";
		states[30] = "NJ - New Jersey";
		states[31] = "NM - New Mexico";
		states[32] = "NY - New York";
		states[33] = "NC - North Carolina";
		states[34] = "ND - North Dakota";
		states[35] = "OH - Ohio";
		states[36] = "OK - Oklahoma";
		states[37] = "OR - Oregon";
		states[38] = "PA - Pennsylvania";
		states[39] = "RI - Rhode Island";
		states[40] = "SC - South Carolina";
		states[41] = "SD - South Dakota";
		states[42] = "TN - Tennessee";
		states[43] = "TX - Texas";
		states[44] = "UT - Utah";
		states[45] = "VT - Vermont";
		states[46] = "VA - Virginia";
		states[47] = "WA - Washington";
		states[48] = "WV - West Virginia";
		states[49] = "WI - Wisconsin";
		states[50] = "WY - Wyoming";
		return states;
	}

	// May be a better way to do the below.
	public TextBox getStateTextBox()
	{
		TextBox state = new TextBox();
		state.setText(this.getValue(this.getSelectedIndex()));
		return state;
	}
}